{include file="public/header" /}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <select name="coin">
                                <option value="">交易币种</option>
                                {if !empty($coin)}
                                {foreach $coin as $k => $v}
                                <option value="{$k}" {if !empty(input('get.coin')) &&
                                    input('get.coin')==$k}selected{/if}>{$v} </option>
                                {/foreach}
                                {/if}
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="mart">
                                <option value="">交易市场</option>
                                {if !empty($mart)}
                                {foreach $mart as $k => $v}
                                <option value="{$k}" {if !empty(input('get.mart')) &&
                                    input('get.mart')==$k}selected{/if}>{$v} </option>
                                {/foreach}
                                {/if}
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="istrans">
                                <option value="">是否可交易</option>
                                <option value="1" {if !empty(input('get.istrans')) &&
                                    input('get.istrans')==1}selected{/if}>是</option>
                                <option value="2" {if !empty(input('get.istrans')) &&
                                    input('get.istrans')==2}selected{/if}>否</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select name="ishow">
                                <option value="">是否显示行情</option>
                                <option value="1" {if !empty(input('get.ishow')) &&
                                    input('get.ishow')==1}selected{/if}>是</option>
                                <option value="2" {if !empty(input('get.ishow')) &&
                                    input('get.ishow')==2}selected{/if}>否</option>
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" lay-submit="" lay-filter="sreach">搜索</button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="data_edit('添加','quotes_edit')"><i
                            class="layui-icon">&#xe654;</i>添加</button>&nbsp;
                    共有数据：<strong id="count">{$list->total()}</strong> 条
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form" lay-size="sm">
                        <thead>
                            <tr>
                                <th width="">ID</th>
                                <th width="">币种名称</th>
                                <th width="">市场名称</th>
                                <th width="">是否可交易</th>
                                <th width="">是否显示行情</th>
                                <th width="">买入手续费</th>
                                <th width="">卖出手续费</th>
                                <th width="">币种名称</th>
                                <th width="">币种logo</th>
                                <th width="">发行时间</th>
                                <th width="">发行总量</th>
                                <th width="">流通总量</th>
                                <th width="">众筹价格</th>
                                <th width="">白皮书</th>
                                <th width="">官网</th>
                                <th width="">区块查询地址</th>
                                <th width="">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {foreach $list as $v}
                            <tr>
                                <td>{$v.id|default='0'}</td>
                                <td>{$v.cointext|default='无'}</td>
                                <td>{$v.marttext|default='无'}</td>
                                <td>{if $v.istrans == 1}
                                    <button onclick="orderstr('确定要关闭交易吗？','/user/userskeys','{$v.id}',1)" type="button"
                                        class="layui-btn layui-btn-warm">是</button>
                                    {else}
                                    <button onclick="orderstr('确定要开启交易吗？','/user/userskeys','{$v.id}',1)" type="button"
                                        class="layui-btn layui-btn-normal">否</button>
                                    {/if}
                                </td>
                                <td>{if $v.ishow == 1}
                                    <button onclick="orderstr('确定要关闭行情吗？','/user/userskeys','{$v.id}',1)" type="button"
                                        class="layui-btn layui-btn-warm">是</button>
                                    {else}
                                    <button onclick="orderstr('确定要开启行情吗？','/user/userskeys','{$v.id}',1)" type="button"
                                        class="layui-btn layui-btn-normal">否</button>
                                    {/if}
                                </td>
                                <td>{$v.buyhand|default='0'}%</td>
                                <td>{$v.sellhand|default='0'}%</td>
                                <td>{$v.name|default=''}</td>
                                <td><img width="100" src="{$v.logos|default=''}" onclick="showimg('{$v.logos}')" /></td>
                                <td>{$v.pubdate|default='0-0-0'}</td>
                                <td>{$v.pubtotal|default=''}</td>
                                <td>{$v.currtotal|default=''}</td>
                                <td>{$v.crowdprice|default=''}</td>
                                <td>{$v.whitepaper|default=''}</td>
                                <td>{$v.website|default=''}</td>
                                <td>{$v.blockqurey|default=''}</td>
                                <td class="td-manage">
                                    <a title="编辑" onclick="data_edit('编辑','/order/quotes_edit?id={$v.id}')"
                                        href="javascript:;" class="layui-btn">
                                        编辑
                                    </a>
                                </td>

                            </tr>
                            {/foreach}

                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$list->render()|raw}
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['upload', 'form'], function () {
        var $ = layui.jquery
            , upload = layui.upload
            , form = layui.form;
        //图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            , url: 'users_top'
            , accept: 'file'
            , exts: 'xls|csv'
            , before: function (obj) {
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                    $('#demo1').attr('src', result); //图片链接（base64）
                });
            }
            , done: function (res) {
                //如果上传失败
                if (res.status > 0) {
                    return layer.msg(res.msg);
                }
                //上传成功
                return layer.msg(res.msg);
            }
            , error: function () {
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function () {
                    uploadInst.upload();
                });
            }
        });
    });
    function showimg(imgs) {
        console.log(imgs);
        layer.open({
            type: 1,
            title: false,
            shadeClose: true,
            skin: 'layui-layer-nobg', //没有背景色
            content: "<img src='" + imgs + "' style='width:100%;height: 100%;'>"
        });
    }
    function orderstr(title, url, id, type) {
        layer.confirm(title, { title: '请谨慎操作' }, function (index) {
            $.post(url, { id: id, type: type }, function (data) {
                if (data.status == 0) {
                    layer.msg(data.msg, { icon: 6, time: 1000 }, function () {
                        location.reload();
                        layer.close(index);
                    });
                } else {
                    layer.msg(data.msg, { icon: 2, time: 1000 });
                }
            });
        });
    }
    function usermoney(url, id) {
        layer.open({
            type: 2,
            area: ['80%', '80%'],
            content: url + '?mobile=' + id,
        });
    }
</script>
{include file="public/footer"}